home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
SGI Developer Toolbox 6.1
/
SGI Developer Toolbox 6.1 - Disc 4.iso
/
src
/
apps
/
xconf
/
xconfr.c++
< prev
Wrap
C/C++ Source or Header
|
1994-08-01
|
1KB
|
56 lines
// unix includes
#include <stdlib.h>
#include <signal.h>
#include <getopt.h>
#include <malloc.h>
// conf includefile
#include "ConfRouter.h"
ConfRouter *theRouter = NULL; // oh, so what if I break down and use a global..
static void quit( int ... )
{
// exit gracefully
theRouter->Quit();
}
void main(int argc, char **argv)
{
signal(SIGHUP, quit);
signal(SIGINT, quit);
signal(SIGQUIT, quit);
signal(SIGPOLL, SIG_IGN);
int port = DEFPORT;
int debug = 0;
extern char* optarg;
extern int optind, opterr;
int c;
while ((c = getopt(argc, argv, "d,p:")) != EOF) {
switch (c) {
case 'd':
debug = 1;
break;
case 'p':
port = atoi(optarg);
break;
case '?':
fprintf(stderr, "Usage: xconfr [-d] [-p port]\n");
exit(-1);
}
}
// create the ConfRouter
theRouter = new ConfRouter();
// initialize the ConfRouter
theRouter->Init(port);
// enter the msg loop.
theRouter->Run();
}